<template>
  <div slot>
    <v-app>


    <v-toolbar color="primary">
      <v-toolbar-side-icon></v-toolbar-side-icon>
      <v-toolbar-title>沪赣农产品溯源系统</v-toolbar-title>
      <v-spacer></v-spacer>

    </v-toolbar>


      <v-content>
        <v-container fluid >
          <v-layout align-center justify-center>
            <v-flex xs12 sm8 md4>
              <v-card  >
                <v-toolbar dark color="primary">
                  <v-toolbar-title>登录到系统</v-toolbar-title>
                  <v-tooltip right>
                    <v-btn slot="activator" icon large href="https://codepen.io/johnjleider/pen/wyYVVj" target="_blank">
                      <v-icon large>mdi-codepen</v-icon>
                    </v-btn>
                    <span>Codepen</span>
                  </v-tooltip>
                </v-toolbar>
                <v-card-text>
                  <v-form>
                    <v-text-field prepend-icon="person" name="username" label="用户名" type="text"
                                  v-model="username"></v-text-field>
                    <v-text-field id="password" prepend-icon="lock" name="password" label="密码" type="password"
                                  v-model="passwd"></v-text-field>
                  </v-form>
                </v-card-text>
                <v-card-actions>
                  <v-spacer></v-spacer>
                  <v-btn color="primary" @click="login">确定</v-btn>
                </v-card-actions>
              </v-card>
            </v-flex>
          </v-layout>
        </v-container>
      </v-content>
    <v-footer
      dark
      height="auto"
      fixed
    >
      <v-card
        flat
        tile
        class="indigo lighten-1 white--text text-xs-center"
        style="width: 100%"
      >


        <v-card-text  >
         基于 <a href="https://www.varda.io" style="color: #fff" target="_blank">varda</a> 区块链技术的沪赣农产品溯源系统Ver:1.0
        </v-card-text>

        <v-divider></v-divider>

        <v-card-text class="white--text">
          &copy;2018 — <strong> 赣州沪赣实业有限公司</strong>
        </v-card-text>
      </v-card>
    </v-footer>
    </v-app>
  </div>
</template>

<script>
  export default {
    name: "Login",
    data: () => ({
      drawer: null,
      username: '',
      passwd: ''
    }),
    methods: {
      login() {
        let this_ = this
        this.axios.post('/index/login/login', {username: this.username, passwd: this.passwd}).then(function (response) {
          console.log(response);
          if (response.data.errno == 0) {
            // alert('登录成功')
            this_.$router.push('/index')
          } else {
            alert(response.data.msg)
          }

        })
        //this.$router.push('/index')
      }
    },
    props: {
      source: String
    }
  }
</script>

<style scoped>

</style>
